package cn.kgc.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration  // <beans> <bean id="userService" class="Docket"></bean> <bean></bean>    </beans>
@EnableSwagger2
@ComponentScan({"cn.kgc.controller"})
public class SwaggerConfig {
    @Bean//<bean id="docket" class="Docket">
    public Docket docket(){
        Docket docket=new Docket(DocumentationType.SWAGGER_2);
        docket.apiInfo(ApiInfo());
        return docket;
    }
    @Bean
    public ApiInfo ApiInfo(){
        return new ApiInfo("爱旅行项目",//标题
                "这是一个旅游网站",
                "v1.0",
                "http://www.baidu.com",
                "何积亮&代伟",
                "授权来源",
                "http://www.163.com");
    }

}